package com.uphone.magicleafteacher.pro.activity;

import android.graphics.Color;
import android.view.View;

import com.uphone.magicleafteacher.MyApp;
import com.uphone.magicleafteacher.base.BaseListActivity;
import com.uphone.magicleafteacher.http.ApiService;
import com.uphone.magicleafteacher.pro.adapter.CoursesAdapter;
import com.uphone.magicleafteacher.util.CommonUtil;
import com.uphone.magicleafteacher.util.GsonUtils;
import com.uphone.magicleafteacher.vo.OtherLiveClassBean;

import java.util.List;

import io.reactivex.Observable;
import okhttp3.ResponseBody;

public class MorecourseActivity extends BaseListActivity<OtherLiveClassBean.LiveClassListBean, CoursesAdapter> {

    @Override
    protected Observable<ResponseBody> loadData(ApiService apiService) {
        return MyApp.apiService(ApiService.class)
                .otherLiveClass(CommonUtil.getTeacherId(), page + "", "10");
    }

    @Override
    protected List<OtherLiveClassBean.LiveClassListBean> getDataList(String json) {
        OtherLiveClassBean otherLiveClassBean = GsonUtils.getGson().fromJson(json, OtherLiveClassBean.class);
        if (otherLiveClassBean != null)
            return otherLiveClassBean.getLiveClassList();
        return null;
    }

    @Override
    protected void itemClick(CoursesAdapter adapter, View view, int position) {
        //点击条目
        CommonUtil.startIntent(this, CoursedetailsActivity.class, mAdapter.getItem(position).getLiveId());

    }

    @Override
    protected CoursesAdapter initAdapter() {
        return new CoursesAdapter();
    }

    @Override
    protected void initBundle() {

    }

    @Override
    protected void initTitle() {
        ll.setBackgroundColor(Color.WHITE);
        initTitle("直播课程");
    }
}
